//
//  ViewController.m
//  看书器
//
//  Created by mac on 15-12-7.
//  Copyright (c) 2015年 wuyinrong. All rights reserved.
//

#import "ViewController.h"
#import "MyBookShellCell.h"
@interface ViewController ()
{
    
    NSArray * imgs;
}
@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.title=@"我的书架";
    self.tableView.showsVerticalScrollIndicator=NO;
    NSBundle * bundle = [NSBundle mainBundle];
    imgs = [bundle URLsForResourcesWithExtension:@"png" subdirectory:nil];
    	// Do any additional setup after loading the view, typically from a nib.
    
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 4;
    
}



-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    NSInteger row = indexPath.row;
    UITableViewCell * cell =[[UITableViewCell alloc]init];
    NSInteger index=row * 3;
    for (int i =0; i <3&& index+1<imgs.count;i++) {
        UIImage * img=[UIImage imageNamed:imgs[index +1]];
        UIImageView * iv =[[UIImageView alloc]initWithImage:img];
        CGFloat edge=15;
        CGFloat width=(self.view.frame.size.width-edge*4/3);
        iv.frame = CGRectMake(edge + (width + edge)*1, 8, width, 139-8-8*2);
        [cell addSubview:iv];
    
    
    }
    return cell;
}





- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
